<?php

class App_Methods_Request_GetUserList {

  /**
   *
   * @var App_Methods_Data_App
   */
  public $app;

  public function __construct($params) {
    $this->app = new App_Methods_Data_App($params->app);
  }

  public function process() {
    if (!Core_Auth::getInstance()->getUser()->isAdmin())
    	throw new App_Exception_App(4000);

    $response = new App_Methods_Response_GetUserList(true);
    $users = UsersQuery::create()
    ->leftJoinUserGroups()
    ->orderByFname(Criteria::ASC)
    ->orderByLname(Criteria::ASC)
    ->find();
    foreach ($users as $user) {
    	$response->addUser($user);
    }
    
    return $response;
  }

}